<template>
	<view style="width:750rpx;height: 100vh;background: #fff;">
		<view style="text-align: center;padding-top: 50rpx;font-size: 36rpx;">高保真防伪系统</view>
		<view class="copyrightnums">V{{version}}</view>
		<u-cell-group>
			<u-cell size="large" title="关注微信" titleStyle="font-size:14px" :value="about.we_chat"></u-cell>
			<u-cell size="large" title="关注微博" titleStyle="font-size:14px" :value="about.micro_blog"></u-cell>
			<u-cell size="large" title="使用说明" titleStyle="font-size:14px" value="查看" @tap="toIllustrate"></u-cell>
			<!-- <u-cell title="隐私协议" :isLink="true" @tap="toPrivacy"></u-cell>
			<u-cell title="服务协议" :isLink="true" @tap="toServer"></u-cell> -->
			<u-cell size="large" title="意见反馈" titleStyle="font-size:14px" :value="about.mail"></u-cell>
			<u-cell size="large" title="商务合作" titleStyle="font-size:14px" :value="about.tel"></u-cell>
		</u-cell-group>
		<view style="width: 700rpx;margin: 0 auto;padding-top: 100rpx;">
			<u-button type="error" text="注销账号" @tap="zxzh"></u-button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				version:'',
				about:{},
				illustrate:''
			}
		},
		onShow(){
			this.init()
		},
		methods: {
			async init() {
				const {
					data,
					code
				} = await this.request('user/about', {}, 'POST')
				
				console.log(data)
				
				if(code==1){
					this.version = data.version
					this.about = data.about
					uni.setStorageSync('illustrate',data.about.illustrate)
					// this.illustrate = data.about.illustrate.replace(/<.+?>/g,"")
				}
			},
			toIllustrate(){
				uni.navigateTo({
					url:'/pages/illustrate/illustrate'
				})
			},
			toPrivacy(){
				uni.navigateTo({
					url:'/pages/privacy-agreement/privacy-agreement'
				})
			},
			toServer(){
				uni.navigateTo({
					url:'/pages/server-agreement/server-agreement'
				})
			},
			zxzh(){
				const that = this;
				uni.showModal({
					title: '提示',
					content:'注销账号后所有数据不可恢复，请谨慎操作',
					success: function (res) {
							if (res.confirm) {
								that.request('user/logout', {}, 'POST').then(zx=>{
									if(zx.code==1){
										uni.reLaunch({
											url:'/pages/accountLogin/accountLogin'
										})
									}
								})
							} else if (res.cancel) {
								console.log('用户点击取消');
							}
						}
					
				})
			}
		}
	}
</script>

<style scoped>
	.logo{
		padding-top: 50rpx;
		display: flex;
		justify-content: center;
	}
	.copyrightnums{
		height: 120rpx;
		line-height: 120rpx;
		text-align: center;
	}

</style>
